import Mock from 'mockjs'

// 查询服务清单列表
export const getServicePage = async (params: Service): Promise<ListServiceRes> => {
  const res = await Mock.mock({
    'list|10': [
      {
        'id|+1': 1,
        serviceName: '@cword(3, 5)',
        serviceCode: '@cword(3, 5)',
        'serviceType|1': [1, 2, 3],
        description: '@cword(3, 5)',
        effectiveDays: '@integer(1, 1000)',
        createTime: 1691727146870
      }
    ],
    total: 100,
    pageNo: 1,
    pageSize: 10
  })
  return res
}

// 查询服务清单详情
export const getService = async (id: number) => {
  const res = await Mock.mock({
    'id|+1': 1,
    serviceName: '@cword(3, 5)',
    serviceCode: '@cword(3, 5)',
    'serviceType|1': [1, 2, 3],
    description: '@cword(3, 5)',
    effectiveDays: '@integer(1, 1000)',
    createTime: 1691727146870
  })
  return res
}

// 名称模糊查询服务清单
export const queryServierByName = async (serviceName: string) => {
  const res = await Mock.mock({
    'list|10': [
      {
        'id|+1': 1,
        serviceName: '@cword(3, 5)',
        'serviceType|1': [1, 2, 3],
        description: '@cword(3, 5)',
        effectiveDays: '@integer(1, 1000)',
        createTime: 1691727146870
      }
    ]
  })
  return res
}

// 新增服务清单
export const createService = async (data: Service) => {
  const res = await Mock.mock({
    isSuccess: true
  })
  return res
}

// 修改服务清单
export const updateService = async (data: Service): Promise<ResStatus> => {
  const res = await Mock.mock({
    isSuccess: true
  })
  return res
}

// 删除服务清单
export const deleteService = async (id: number): Promise<ResStatus> => {
  const res = await Mock.mock({
    isSuccess: true
  })
  return res
}
